import { Entity, Column, ManyToMany, Index } from "typeorm";
import BaseEntity from "./base";
import { Board } from "./board";
import { Post } from "./post";

@Entity("tags")
export class Tag extends BaseEntity {
  @Index("tag_index")
  @Column({
    unique: true,
  })
  tag: string;

  @ManyToMany(() => Post, (post) => post.tags)
  posts: Post[];

  @ManyToMany(() => Board, (board) => board.tags)
  boards: Post[];
}
